﻿// Decompiled with JetBrains decompiler
// Type: HalconDotNet.HTuple
// Assembly: halcondotnet, Version=20.5.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8
// MVID: EB5C7AFA-B5C5-4EF9-B907-42E20F56E96C
// Assembly location: D:\T9AOIHalcon\suncoappearancevision20231211\SuncoAppearanceVision\AppearanceVision\bin\Debug\halcondotnet.dll

using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;

namespace HalconDotNet
{
    [Serializable]
    public class HTuple : ISerializable, ICloneable, IDisposable
    {
        internal HTupleImplementation data;
        private static HTuple.NativeInt2To1 addInt = new HTuple.NativeInt2To1(HTuple.NativeIntAdd);
        private static HTuple.NativeLong2To1 addLong = new HTuple.NativeLong2To1(HTuple.NativeLongAdd);
        private static HTuple.NativeDouble2To1 addDouble = new HTuple.NativeDouble2To1(HTuple.NativeDoubleAdd);
        private static HTuple.NativeInt2To1 subInt = new HTuple.NativeInt2To1(HTuple.NativeIntSub);
        private static HTuple.NativeLong2To1 subLong = new HTuple.NativeLong2To1(HTuple.NativeLongSub);
        private static HTuple.NativeDouble2To1 subDouble = new HTuple.NativeDouble2To1(HTuple.NativeDoubleSub);
        private static HTuple.NativeInt2To1 multInt = new HTuple.NativeInt2To1(HTuple.NativeIntMult);
        private static HTuple.NativeLong2To1 multLong = new HTuple.NativeLong2To1(HTuple.NativeLongMult);
        private static HTuple.NativeDouble2To1 multDouble = new HTuple.NativeDouble2To1(HTuple.NativeDoubleMult);

        void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
        {
            HSerializedItem hserializedItem = this.SerializeTuple();
            byte[] numArray = (byte[])hserializedItem;
            hserializedItem.Dispose();
            info.AddValue("data", (object)numArray, typeof(byte[]));
        }

        [EditorBrowsable(EditorBrowsableState.Never)]
        public HTuple(SerializationInfo info, StreamingContext context)
        {
            HSerializedItem serializedItemHandle = new HSerializedItem((byte[])info.GetValue(nameof(data), typeof(byte[])));
            this.data = HTuple.DeserializeTuple(serializedItemHandle).data;
            serializedItemHandle.Dispose();
        }

        public void Serialize(Stream stream)
        {
            HSerializedItem hserializedItem = this.SerializeTuple();
            hserializedItem.Serialize(stream);
            hserializedItem.Dispose();
        }

        public static HTuple Deserialize(Stream stream)
        {
            HTuple htuple1 = new HTuple();
            HSerializedItem serializedItemHandle = HSerializedItem.Deserialize(stream);
            HTuple htuple2 = HTuple.DeserializeTuple(serializedItemHandle);
            serializedItemHandle.Dispose();
            return htuple2;
        }

        object ICloneable.Clone() => (object)this.Clone();

        public HTuple TupleUnion(HTuple set2)
        {
            IntPtr proc = HalconAPI.PreCall(96);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, set2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(set2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIntersection(HTuple set2)
        {
            IntPtr proc = HalconAPI.PreCall(97);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, set2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(set2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleDifference(HTuple set2)
        {
            IntPtr proc = HalconAPI.PreCall(98);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, set2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(set2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSymmdiff(HTuple set2)
        {
            IntPtr proc = HalconAPI.PreCall(99);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, set2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(set2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsStringElem()
        {
            IntPtr proc = HalconAPI.PreCall(100);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsRealElem()
        {
            IntPtr proc = HalconAPI.PreCall(101);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsIntElem()
        {
            IntPtr proc = HalconAPI.PreCall(102);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleTypeElem()
        {
            IntPtr proc = HalconAPI.PreCall(103);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsMixed()
        {
            IntPtr proc = HalconAPI.PreCall(104);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsString()
        {
            IntPtr proc = HalconAPI.PreCall(105);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsReal()
        {
            IntPtr proc = HalconAPI.PreCall(106);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsInt()
        {
            IntPtr proc = HalconAPI.PreCall(107);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleType()
        {
            IntPtr proc = HalconAPI.PreCall(108);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleHistoRange(HTuple min, HTuple max, HTuple numBins, out HTuple binSize)
        {
            IntPtr proc = HalconAPI.PreCall(109);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, min);
            HalconAPI.Store(proc, 2, max);
            HalconAPI.Store(proc, 3, numBins);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1 = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(min);
            HalconAPI.UnpinTuple(max);
            HalconAPI.UnpinTuple(numBins);
            HTuple tuple;
            int err2 = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err1, out tuple);
            int procResult = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, err2, out binSize);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleRegexpSelect(HTuple expression)
        {
            IntPtr proc = HalconAPI.PreCall(110);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, expression);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(expression);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleRegexpTest(HTuple expression)
        {
            IntPtr proc = HalconAPI.PreCall(111);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, expression);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(expression);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleRegexpReplace(HTuple expression, HTuple replace)
        {
            IntPtr proc = HalconAPI.PreCall(112);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, expression);
            HalconAPI.Store(proc, 2, replace);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(expression);
            HalconAPI.UnpinTuple(replace);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleRegexpMatch(HTuple expression)
        {
            IntPtr proc = HalconAPI.PreCall(113);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, expression);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(expression);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public static HTuple TupleRand(HTuple length)
        {
            IntPtr proc = HalconAPI.PreCall(114);
            HalconAPI.Store(proc, 0, length);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            HalconAPI.UnpinTuple(length);
            HTuple tuple;
            HalconAPI.PostCall(proc, HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple));
            return tuple;
        }

        private HTuple TupleLengthOp()
        {
            IntPtr proc = HalconAPI.PreCall(115);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSgn()
        {
            IntPtr proc = HalconAPI.PreCall(116);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleMax2(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(117);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleMin2(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(118);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleMax()
        {
            IntPtr proc = HalconAPI.PreCall(119);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleMin()
        {
            IntPtr proc = HalconAPI.PreCall(120);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleCumul()
        {
            IntPtr proc = HalconAPI.PreCall(121);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSelectRank(HTuple rankIndex)
        {
            IntPtr proc = HalconAPI.PreCall(122);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, rankIndex);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(rankIndex);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleMedian()
        {
            IntPtr proc = HalconAPI.PreCall(123);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSum()
        {
            IntPtr proc = HalconAPI.PreCall(124);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleMean()
        {
            IntPtr proc = HalconAPI.PreCall(125);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleDeviation()
        {
            IntPtr proc = HalconAPI.PreCall(126);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleUniq()
        {
            IntPtr proc = HalconAPI.PreCall((int)sbyte.MaxValue);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleFindLast(HTuple toFind)
        {
            IntPtr proc = HalconAPI.PreCall(128);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, toFind);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(toFind);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleFindFirst(HTuple toFind)
        {
            IntPtr proc = HalconAPI.PreCall(129);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, toFind);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(toFind);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleFind(HTuple toFind)
        {
            IntPtr proc = HalconAPI.PreCall(130);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, toFind);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(toFind);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSortIndex()
        {
            IntPtr proc = HalconAPI.PreCall(131);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSort()
        {
            IntPtr proc = HalconAPI.PreCall(132);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleInverse()
        {
            IntPtr proc = HalconAPI.PreCall(133);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        private HTuple TupleConcatOp(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(134);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSelectRange(HTuple leftindex, HTuple rightindex)
        {
            IntPtr proc = HalconAPI.PreCall(135);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, leftindex);
            HalconAPI.Store(proc, 2, rightindex);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(leftindex);
            HalconAPI.UnpinTuple(rightindex);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLastN(HTuple index)
        {
            IntPtr proc = HalconAPI.PreCall(136);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, index);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(index);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleFirstN(HTuple index)
        {
            IntPtr proc = HalconAPI.PreCall(137);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, index);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(index);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleInsert(HTuple index, HTuple insertTuple)
        {
            IntPtr proc = HalconAPI.PreCall(138);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, index);
            HalconAPI.Store(proc, 2, insertTuple);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(index);
            HalconAPI.UnpinTuple(insertTuple);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleReplace(HTuple index, HTuple replaceTuple)
        {
            IntPtr proc = HalconAPI.PreCall(139);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, index);
            HalconAPI.Store(proc, 2, replaceTuple);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(index);
            HalconAPI.UnpinTuple(replaceTuple);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleRemove(HTuple index)
        {
            IntPtr proc = HalconAPI.PreCall(140);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, index);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(index);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSelectMask(HTuple mask)
        {
            IntPtr proc = HalconAPI.PreCall(141);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, mask);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(mask);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSelect(HTuple index)
        {
            IntPtr proc = HalconAPI.PreCall(142);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, index);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(index);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleStrBitSelect(HTuple index)
        {
            IntPtr proc = HalconAPI.PreCall(143);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, index);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(index);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public static HTuple TupleGenSequence(HTuple start, HTuple end, HTuple step)
        {
            IntPtr proc = HalconAPI.PreCall(144);
            HalconAPI.Store(proc, 0, start);
            HalconAPI.Store(proc, 1, end);
            HalconAPI.Store(proc, 2, step);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            HalconAPI.UnpinTuple(start);
            HalconAPI.UnpinTuple(end);
            HalconAPI.UnpinTuple(step);
            HTuple tuple;
            HalconAPI.PostCall(proc, HTuple.LoadNew(proc, 0, err, out tuple));
            return tuple;
        }

        public static HTuple TupleGenConst(HTuple length, HTuple constVal)
        {
            IntPtr proc = HalconAPI.PreCall(145);
            HalconAPI.Store(proc, 0, length);
            HalconAPI.Store(proc, 1, constVal);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            HalconAPI.UnpinTuple(length);
            HalconAPI.UnpinTuple(constVal);
            HTuple tuple;
            HalconAPI.PostCall(proc, HTuple.LoadNew(proc, 0, err, out tuple));
            return tuple;
        }

        public HTuple TupleEnvironment()
        {
            IntPtr proc = HalconAPI.PreCall(146);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSplit(HTuple separator)
        {
            IntPtr proc = HalconAPI.PreCall(147);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, separator);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(separator);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSubstr(HTuple position1, HTuple position2)
        {
            IntPtr proc = HalconAPI.PreCall(148);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, position1);
            HalconAPI.Store(proc, 2, position2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(position1);
            HalconAPI.UnpinTuple(position2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleStrLastN(HTuple position)
        {
            IntPtr proc = HalconAPI.PreCall(149);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, position);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(position);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleStrFirstN(HTuple position)
        {
            IntPtr proc = HalconAPI.PreCall(150);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, position);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(position);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleStrrchr(HTuple toFind)
        {
            IntPtr proc = HalconAPI.PreCall(151);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, toFind);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(toFind);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleStrchr(HTuple toFind)
        {
            IntPtr proc = HalconAPI.PreCall(152);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, toFind);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(toFind);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleStrrstr(HTuple toFind)
        {
            IntPtr proc = HalconAPI.PreCall(153);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, toFind);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(toFind);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleStrstr(HTuple toFind)
        {
            IntPtr proc = HalconAPI.PreCall(154);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, toFind);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(toFind);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleStrlen()
        {
            IntPtr proc = HalconAPI.PreCall(155);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLessEqualElem(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(156);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLessElem(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(157);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleGreaterEqualElem(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(158);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleGreaterElem(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(159);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleNotEqualElem(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(160);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleEqualElem(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(161);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLessEqual(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(162);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLess(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(163);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleGreaterEqual(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(164);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleGreater(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(165);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleNotEqual(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(166);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleEqual(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(167);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleNot()
        {
            IntPtr proc = HalconAPI.PreCall(168);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleXor(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(169);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleOr(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(170);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleAnd(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(171);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleBnot()
        {
            IntPtr proc = HalconAPI.PreCall(172);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleBxor(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(173);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleBor(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(174);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleBand(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(175);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleRsh(HTuple shift)
        {
            IntPtr proc = HalconAPI.PreCall(176);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, shift);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(shift);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLsh(HTuple shift)
        {
            IntPtr proc = HalconAPI.PreCall(177);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, shift);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(shift);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleChrt()
        {
            IntPtr proc = HalconAPI.PreCall(178);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleOrds()
        {
            IntPtr proc = HalconAPI.PreCall(179);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleChr()
        {
            IntPtr proc = HalconAPI.PreCall(180);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleOrd()
        {
            IntPtr proc = HalconAPI.PreCall(181);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleString(HTuple format)
        {
            IntPtr proc = HalconAPI.PreCall(182);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, format);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(format);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsNumber()
        {
            IntPtr proc = HalconAPI.PreCall(183);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleNumber()
        {
            IntPtr proc = HalconAPI.PreCall(184);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleRound()
        {
            IntPtr proc = HalconAPI.PreCall(185);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleInt()
        {
            IntPtr proc = HalconAPI.PreCall(186);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleReal()
        {
            IntPtr proc = HalconAPI.PreCall(187);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLdexp(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(188);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleFmod(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(189);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleMod(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(190);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleCeil()
        {
            IntPtr proc = HalconAPI.PreCall(191);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleFloor()
        {
            IntPtr proc = HalconAPI.PreCall(192);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TuplePow(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(193);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLog10()
        {
            IntPtr proc = HalconAPI.PreCall(194);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLog()
        {
            IntPtr proc = HalconAPI.PreCall(195);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleExp()
        {
            IntPtr proc = HalconAPI.PreCall(196);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleTanh()
        {
            IntPtr proc = HalconAPI.PreCall(197);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleCosh()
        {
            IntPtr proc = HalconAPI.PreCall(198);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSinh()
        {
            IntPtr proc = HalconAPI.PreCall(199);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleRad()
        {
            IntPtr proc = HalconAPI.PreCall(200);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleDeg()
        {
            IntPtr proc = HalconAPI.PreCall(201);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleAtan2(HTuple x)
        {
            IntPtr proc = HalconAPI.PreCall(202);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, x);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(x);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleAtan()
        {
            IntPtr proc = HalconAPI.PreCall(203);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleAcos()
        {
            IntPtr proc = HalconAPI.PreCall(204);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleAsin()
        {
            IntPtr proc = HalconAPI.PreCall(205);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleTan()
        {
            IntPtr proc = HalconAPI.PreCall(206);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleCos()
        {
            IntPtr proc = HalconAPI.PreCall(207);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSin()
        {
            IntPtr proc = HalconAPI.PreCall(208);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleFabs()
        {
            IntPtr proc = HalconAPI.PreCall(209);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSqrt()
        {
            IntPtr proc = HalconAPI.PreCall(210);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleAbs()
        {
            IntPtr proc = HalconAPI.PreCall(211);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleNeg()
        {
            IntPtr proc = HalconAPI.PreCall(212);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleDiv(HTuple q2)
        {
            IntPtr proc = HalconAPI.PreCall(213);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, q2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(q2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        private HTuple TupleMultOp(HTuple p2)
        {
            IntPtr proc = HalconAPI.PreCall(214);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, p2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(p2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        private HTuple TupleSubOp(HTuple d2)
        {
            IntPtr proc = HalconAPI.PreCall(215);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, d2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(d2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        private HTuple TupleAddOp(HTuple s2)
        {
            IntPtr proc = HalconAPI.PreCall(216);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, s2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(s2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public static HTuple DeserializeTuple(HSerializedItem serializedItemHandle)
        {
            IntPtr proc = HalconAPI.PreCall(217);
            HalconAPI.Store(proc, 0, (HHandle)serializedItemHandle);
            HalconAPI.InitOCT(proc, 0);
            HTuple tuple;
            HalconAPI.PostCall(proc, HTuple.LoadNew(proc, 0, HalconAPI.CallProcedure(proc), out tuple));
            GC.KeepAlive((object)serializedItemHandle);
            return tuple;
        }

        public HSerializedItem SerializeTuple()
        {
            IntPtr proc = HalconAPI.PreCall(218);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HSerializedItem hserializedItem;
            int procResult = HSerializedItem.LoadNew(proc, 0, err, out hserializedItem);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return hserializedItem;
        }

        public void WriteTuple(HTuple fileName)
        {
            IntPtr proc = HalconAPI.PreCall(219);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, fileName);
            int procResult = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(fileName);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }

        public static HTuple ReadTuple(HTuple fileName)
        {
            IntPtr proc = HalconAPI.PreCall(220);
            HalconAPI.Store(proc, 0, fileName);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            HalconAPI.UnpinTuple(fileName);
            HTuple tuple;
            HalconAPI.PostCall(proc, HTuple.LoadNew(proc, 0, err, out tuple));
            return tuple;
        }

        public void ClearHandle()
        {
            IntPtr proc = HalconAPI.PreCall(2134);
            this.Store(proc, 0);
            int procResult = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }

        public HTuple TupleIsHandle()
        {
            IntPtr proc = HalconAPI.PreCall(2139);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsHandleElem()
        {
            IntPtr proc = HalconAPI.PreCall(2140);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsSerializable()
        {
            IntPtr proc = HalconAPI.PreCall(2141);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsSerializableElem()
        {
            IntPtr proc = HalconAPI.PreCall(2142);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleIsValidHandle()
        {
            IntPtr proc = HalconAPI.PreCall(2143);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSemType()
        {
            IntPtr proc = HalconAPI.PreCall(2144);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleSemTypeElem()
        {
            IntPtr proc = HalconAPI.PreCall(2145);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleAcosh()
        {
            IntPtr proc = HalconAPI.PreCall(2192);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleAsinh()
        {
            IntPtr proc = HalconAPI.PreCall(2193);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleAtanh()
        {
            IntPtr proc = HalconAPI.PreCall(2194);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleCbrt()
        {
            IntPtr proc = HalconAPI.PreCall(2195);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleErf()
        {
            IntPtr proc = HalconAPI.PreCall(2196);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleErfc()
        {
            IntPtr proc = HalconAPI.PreCall(2197);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleExp10()
        {
            IntPtr proc = HalconAPI.PreCall(2198);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleExp2()
        {
            IntPtr proc = HalconAPI.PreCall(2199);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleHypot(HTuple t2)
        {
            IntPtr proc = HalconAPI.PreCall(2200);
            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, t2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HalconAPI.UnpinTuple(t2);
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLgamma()
        {
            IntPtr proc = HalconAPI.PreCall(2201);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleLog2()
        {
            IntPtr proc = HalconAPI.PreCall(2202);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple TupleTgamma()
        {
            IntPtr proc = HalconAPI.PreCall(2203);
            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            this.UnpinTuple();
            HTuple tuple;
            int procResult = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err, out tuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return tuple;
        }

        public HTuple() => this.data = (HTupleImplementation)HTupleVoid.EMPTY;

        public HTuple(bool b)
          : this(new IntPtr(b ? 1 : 0))
        {
        }

        public HTuple(int i) => this.data = (HTupleImplementation)new HTupleInt32(i);

        public HTuple(params int[] i) => this.data = (HTupleImplementation)new HTupleInt32(i, true);

        public HTuple(long l) => this.data = (HTupleImplementation)new HTupleInt64(l);

        public HTuple(params long[] l) => this.data = (HTupleImplementation)new HTupleInt64(l, true);

        public HTuple(IntPtr ip)
          : this(new IntPtr[1] { ip })
        {
        }

        public HTuple(params IntPtr[] ip)
        {
            if (HalconAPI.isPlatform64)
            {
                long[] l = new long[ip.Length];
                for (int index = 0; index < ip.Length; ++index)
                    l[index] = ip[index].ToInt64();
                this.data = (HTupleImplementation)new HTupleInt64(l, false);
            }
            else
            {
                int[] i = new int[ip.Length];
                for (int index = 0; index < ip.Length; ++index)
                    i[index] = ip[index].ToInt32();
                this.data = (HTupleImplementation)new HTupleInt32(i, false);
            }
        }

        internal HTuple(int i, bool platformSize)
        {
            if (platformSize && HalconAPI.isPlatform64)
                this.data = (HTupleImplementation)new HTupleInt64((long)i);
            else
                this.data = (HTupleImplementation)new HTupleInt32(i);
        }

        public HTuple(double d) => this.data = (HTupleImplementation)new HTupleDouble(d);

        public HTuple(params double[] d)
        {
            this.data = (HTupleImplementation)new HTupleDouble(d, true);
        }

        public HTuple(float f) => this.data = (HTupleImplementation)new HTupleDouble((double)f);

        public HTuple(params float[] f) => this.data = (HTupleImplementation)new HTupleDouble(f);

        public HTuple(string s) => this.data = (HTupleImplementation)new HTupleString(s);

        public HTuple(params string[] s)
        {
            this.data = (HTupleImplementation)new HTupleString(s, true);
        }

        public HTuple(HHandle h) => this.data = (HTupleImplementation)new HTupleHandle(h);

        public HTuple(params HHandle[] h)
        {
            this.data = (HTupleImplementation)new HTupleHandle(h, true);
        }

        internal HTuple(object o) => this.data = (HTupleImplementation)new HTupleMixed(o);

        public HTuple(params object[] o) => this.data = (HTupleImplementation)new HTupleMixed(o, true);

        public HTuple(HTuple t)
        {
            switch (t.Type)
            {
                case HTupleType.INTEGER:
                    this.data = (HTupleImplementation)new HTupleInt32(t.ToIArr(), false);
                    break;
                case HTupleType.DOUBLE:
                    this.data = (HTupleImplementation)new HTupleDouble(t.ToDArr(), false);
                    break;
                case HTupleType.STRING:
                    this.data = (HTupleImplementation)new HTupleString(t.ToSArr(), false);
                    break;
                case HTupleType.MIXED:
                    this.data = (HTupleImplementation)new HTupleMixed(t.ToOArr(), false);
                    break;
                case HTupleType.HANDLE:
                    this.data = (HTupleImplementation)new HTupleHandle(t.ToHArr(), false);
                    break;
                case HTupleType.EMPTY:
                    this.data = (HTupleImplementation)HTupleVoid.EMPTY;
                    break;
                case HTupleType.LONG:
                    this.data = (HTupleImplementation)new HTupleInt64(t.ToLArr(), false);
                    break;
                default:
                    throw new HTupleAccessException("Inconsistent tuple state encountered");
            }
        }

        public HTuple(params HTuple[] t)
          : this()
        {
            this.TransferOwnership(new HTuple().TupleConcat(t));
        }

        internal HTuple(HTupleImplementation data) => this.data = data;

        [EditorBrowsable(EditorBrowsableState.Never)]
        public void TransferOwnership(HTuple source)
        {
            if (source == this)
                return;
            if (source == null)
            {
                this.data = (HTupleImplementation)HTupleVoid.EMPTY;
            }
            else
            {
                this.data = source.data;
                source.data = (HTupleImplementation)HTupleVoid.EMPTY;
            }
        }

        public HTuple Clone()
        {
            if (this.Type != HTupleType.HANDLE && this.Type != HTupleType.MIXED)
                return new HTuple(this);
            using (HSerializedItem serializedItemHandle = this.SerializeTuple())
                return HTuple.DeserializeTuple(serializedItemHandle);
        }

        public void Dispose() => this.data.Dispose();

        public HTupleType Type => this.data.Type;

        public int Length => this.data.Length;

        public void UnpinTuple() => this.data.UnpinTuple();

        public HTupleElements this[int[] indices]
        {
            get
            {
                foreach (int index in indices)
                {
                    if (index < 0 || index >= this.data.Length)
                        throw new HTupleAccessException("Index out of range");
                }
                return this.data.GetElements(indices, this);
            }
            set
            {
                if (indices.Length == 0)
                {
                    if (value.Length > 1)
                        throw new HTupleAccessException("Input parameter 2 ('Value') must have one element or the same number of elements as parameter 1 ('Index')");
                }
                else
                {
                    foreach (int index in indices)
                    {
                        if (index < 0)
                            throw new HTupleAccessException("Index out of range");
                    }
                    if (this.data.Type == HTupleType.EMPTY)
                    {
                        switch (value.Type)
                        {
                            case HTupleType.INTEGER:
                                this.data = (HTupleImplementation)new HTupleInt32(0);
                                break;
                            case HTupleType.DOUBLE:
                                this.data = (HTupleImplementation)new HTupleDouble(0.0);
                                break;
                            case HTupleType.STRING:
                                this.data = (HTupleImplementation)new HTupleString("");
                                break;
                            case HTupleType.MIXED:
                                this.data = (HTupleImplementation)new HTupleMixed((object)0);
                                break;
                            case HTupleType.HANDLE:
                                this.data = (HTupleImplementation)new HTupleHandle((HHandle)null);
                                break;
                            case HTupleType.LONG:
                                this.data = (HTupleImplementation)new HTupleInt64(0L);
                                break;
                            default:
                                throw new HTupleAccessException("Inconsistent tuple state encountered");
                        }
                    }
                    this.data.AssertSize(indices);
                    if (value.Type != this.data.Type)
                        this.ConvertToMixed();
                    try
                    {
                        this.data.SetElements(indices, value);
                    }
                    catch (HTupleAccessException ex)
                    {
                        this.ConvertToMixed();
                        this.data.SetElements(indices, value);
                    }
                }
            }
        }

        public HTupleElements this[int index]
        {
            get
            {
                if (index < 0 || index >= this.data.Length)
                    throw new HTupleAccessException("Index out of range");
                return this.data.GetElement(index, this);
            }
            set => this[new int[1] { index }] = value;
        }

        internal static int[] GetIndicesFromTuple(HTuple indices)
        {
            if (indices.Type == HTupleType.LONG || indices.Type == HTupleType.INTEGER)
                return indices.ToIArr();
            int[] indicesFromTuple = new int[indices.Length];
            for (int index = 0; index < indices.Length; ++index)
            {
                if (indices[index].Type == HTupleType.INTEGER)
                    indicesFromTuple[index] = indices[index].I;
                else if (indices[index].Type == HTupleType.LONG)
                {
                    indicesFromTuple[index] = indices[index].I;
                }
                else
                {
                    if (indices[index].Type != HTupleType.DOUBLE)
                        throw new HTupleAccessException("Invalid index type");
                    double d = indices[index].D;
                    int num = (int)d;
                    indicesFromTuple[index] = (double)num == d ? num : throw new HTupleAccessException("Index has fractional part");
                }
            }
            return indicesFromTuple;
        }

        public HTupleElements this[HTuple indices]
        {
            get => this[HTuple.GetIndicesFromTuple(indices)];
            set => this[HTuple.GetIndicesFromTuple(indices)] = value;
        }

        private void ConvertToMixed()
        {
            if (this.data is HTupleMixed)
                return;
            HTupleImplementation htupleImplementation = (HTupleImplementation)new HTupleMixed(this.data);
            this.data.Dispose();
            this.data = htupleImplementation;
        }

        internal HTupleElementsMixed ConvertToMixed(int[] indices)
        {
            this.ConvertToMixed();
            return new HTupleElementsMixed((HTupleMixed)this.data, indices);
        }

        public int[] IArr
        {
            get => this.data.IArr;
            set
            {
                if (this.Type == HTupleType.INTEGER)
                    this.data.IArr = value;
                else
                    this.data = (HTupleImplementation)new HTupleInt32(value, false);
            }
        }

        public long[] LArr
        {
            get => this.data.LArr;
            set
            {
                if (this.Type == HTupleType.LONG)
                    this.data.LArr = value;
                else
                    this.data = (HTupleImplementation)new HTupleInt64(value, false);
            }
        }

        public double[] DArr
        {
            get => this.data.DArr;
            set
            {
                if (this.Type == HTupleType.DOUBLE)
                    this.data.DArr = value;
                else
                    this.data = (HTupleImplementation)new HTupleDouble(value, false);
            }
        }

        public string[] SArr
        {
            get => this.data.SArr;
            set
            {
                if (this.Type == HTupleType.STRING)
                    this.data.SArr = value;
                else
                    this.data = (HTupleImplementation)new HTupleString(value, false);
            }
        }

        public HHandle[] HArr
        {
            get => this.data.HArr;
            set
            {
                if (this.Type == HTupleType.HANDLE)
                    this.data.HArr = value;
                else
                    this.data = (HTupleImplementation)new HTupleHandle(value, false);
            }
        }

        [EditorBrowsable(EditorBrowsableState.Never)]
        public object[] OArr => this.data.OArr;

        public int[] ToIArr() => this.data.ToIArr();

        public long[] ToLArr() => this.data.ToLArr();

        public double[] ToDArr() => this.data.ToDArr();

        public string[] ToSArr() => this.data.ToSArr();

        public HHandle[] ToHArr() => this.data.ToHArr();

        public object[] ToOArr() => this.data.ToOArr();

        public float[] ToFArr() => this.data.ToFArr();

        public IntPtr[] ToIPArr() => this.data.ToIPArr();

        public int I
        {
            get => this[0].I;
            set => this[0].I = value;
        }

        public long L
        {
            get => this[0].L;
            set => this[0].L = value;
        }

        public double D
        {
            get => this[0].D;
            set => this[0].D = value;
        }

        public string S
        {
            get => this[0].S;
            set => this[0].S = value;
        }

        public HHandle H
        {
            get => this[0].H;
            set => this[0].H = value;
        }

        public object O
        {
            get => this[0].O;
            set => this[0].O = value;
        }

        public IntPtr IP
        {
            get => this[0].IP;
            set => this[0].IP = value;
        }

        public static implicit operator HTupleElements(HTuple t)
        {
            if (t.Length == 1)
                return t[0];
            int[] indices = new int[t.Length];
            for (int index = 0; index < t.Length; ++index)
                indices[index] = index;
            return t[indices];
        }

        public static implicit operator bool(HTuple t) => (bool)t[0];

        public static implicit operator int(HTuple t) => (int)t[0];

        public static implicit operator long(HTuple t) => (long)t[0];

        public static implicit operator double(HTuple t) => (double)t[0];

        public static implicit operator string(HTuple t) => (string)t[0];

        public static implicit operator IntPtr(HTuple t) => (IntPtr)t[0];

        public static implicit operator int[](HTuple t) => t.ToIArr();

        public static implicit operator long[](HTuple t) => t.ToLArr();

        public static implicit operator double[](HTuple t) => t.ToDArr();

        public static implicit operator string[](HTuple t) => t.ToSArr();

        public static implicit operator HHandle[](HTuple t) => t.ToHArr();

        public static implicit operator IntPtr[](HTuple t) => t.ToIPArr();

        public static implicit operator HTuple(HTupleElements e)
        {
            switch (e.Type)
            {
                case HTupleType.INTEGER:
                    return new HTuple(e.IArr);
                case HTupleType.DOUBLE:
                    return new HTuple(e.DArr);
                case HTupleType.STRING:
                    return new HTuple(e.SArr);
                case HTupleType.MIXED:
                    return new HTuple(e.OArr);
                case HTupleType.HANDLE:
                    return new HTuple(e.HArr);
                case HTupleType.EMPTY:
                    return new HTuple();
                case HTupleType.LONG:
                    return new HTuple(e.LArr);
                default:
                    throw new HTupleAccessException("Inconsistent tuple state encountered");
            }
        }

        public static implicit operator HTuple(int i) => new HTuple(i);

        public static implicit operator HTuple(int[] i) => new HTuple(i);

        public static implicit operator HTuple(long l) => new HTuple(l);

        public static implicit operator HTuple(long[] l) => new HTuple(l);

        public static implicit operator HTuple(double d) => new HTuple(d);

        public static implicit operator HTuple(double[] d) => new HTuple(d);

        public static implicit operator HTuple(string s) => new HTuple(s);

        public static implicit operator HTuple(string[] s) => new HTuple(s);

        public static implicit operator HTuple(HHandle h) => new HTuple(h);

        public static implicit operator HTuple(HHandle[] h) => new HTuple(h);

        public static implicit operator HTuple(object[] o) => new HTuple(o);

        public static implicit operator HTuple(IntPtr ip) => new HTuple(ip);

        public static implicit operator HTuple(IntPtr[] ip) => new HTuple(ip);

        internal void Store(IntPtr proc, int parIndex) => this.data.Store(proc, parIndex);

        internal int Load(IntPtr proc, int parIndex, HTupleType type, int err)
        {
            if (!HalconAPI.IsFailure(err))
                return HTupleImplementation.Load(proc, parIndex, type, out this.data);
            this.data = (HTupleImplementation)HTupleVoid.EMPTY;
            return err;
        }

        internal int Load(IntPtr proc, int parIndex, int err)
        {
            return this.Load(proc, parIndex, HTupleType.MIXED, err);
        }

        [EditorBrowsable(EditorBrowsableState.Never)]
        public static int LoadNew(
          IntPtr proc,
          int parIndex,
          HTupleType type,
          int err,
          out HTuple tuple)
        {
            tuple = new HTuple();
            return tuple.Load(proc, parIndex, type, err);
        }

        [EditorBrowsable(EditorBrowsableState.Never)]
        public static int LoadNew(IntPtr proc, int parIndex, int err, out HTuple tuple)
        {
            tuple = new HTuple();
            return tuple.Load(proc, parIndex, HTupleType.MIXED, err);
        }

        public override string ToString()
        {
            object[] oarr = this.ToOArr();
            string str1 = "";
            if (this.Length != 1)
                str1 += "[";
            for (int index = 0; index < oarr.Length; ++index)
            {
                string str2 = str1 + (index > 0 ? ", " : "");
                str1 = this[index].Type != HTupleType.STRING ? str2 + oarr[index].ToString() : str2 + "\"" + oarr[index].ToString() + "\"";
                if (oarr[index] is IDisposable disposable)
                    disposable.Dispose();
            }
            if (this.Length != 1)
                str1 += "]";
            return str1;
        }

        public static HTuple operator +(HTuple t1, HTuple t2) => t1.TupleAdd(t2);

        public static HTuple operator +(HTuple t1, int t2) => t1 + (HTuple)t2;

        public static HTuple operator +(HTuple t1, long t2) => t1 + (HTuple)t2;

        public static HTuple operator +(HTuple t1, float t2) => t1 + (HTuple)(double)t2;

        public static HTuple operator +(HTuple t1, double t2) => t1 + (HTuple)t2;

        public static HTuple operator +(HTuple t1, string t2) => t1 + (HTuple)t2;

        public static HTuple operator +(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 + htuple;
        }

        public static HTuple operator -(HTuple t1, HTuple t2) => t1.TupleSub(t2);

        public static HTuple operator -(HTuple t1, int t2) => t1 - (HTuple)t2;

        public static HTuple operator -(HTuple t1, long t2) => t1 - (HTuple)t2;

        public static HTuple operator -(HTuple t1, float t2) => t1 - (HTuple)(double)t2;

        public static HTuple operator -(HTuple t1, double t2) => t1 - (HTuple)t2;

        public static HTuple operator -(HTuple t1, string t2) => t1 - (HTuple)t2;

        public static HTuple operator -(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 - htuple;
        }

        public static HTuple operator *(HTuple t1, HTuple t2) => t1.TupleMult(t2);

        public static HTuple operator *(HTuple t1, int t2) => t1 * (HTuple)t2;

        public static HTuple operator *(HTuple t1, long t2) => t1 * (HTuple)t2;

        public static HTuple operator *(HTuple t1, float t2) => t1 * (HTuple)(double)t2;

        public static HTuple operator *(HTuple t1, double t2) => t1 * (HTuple)t2;

        public static HTuple operator *(HTuple t1, string t2) => t1 * (HTuple)t2;

        public static HTuple operator *(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 * htuple;
        }

        public static HTuple operator /(HTuple t1, HTuple t2) => t1.TupleDiv(t2);

        public static HTuple operator /(HTuple t1, int t2) => t1 / (HTuple)t2;

        public static HTuple operator /(HTuple t1, long t2) => t1 / (HTuple)t2;

        public static HTuple operator /(HTuple t1, float t2) => t1 / (HTuple)(double)t2;

        public static HTuple operator /(HTuple t1, double t2) => t1 / (HTuple)t2;

        public static HTuple operator /(HTuple t1, string t2) => t1 / (HTuple)t2;

        public static HTuple operator /(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 / htuple;
        }

        public static HTuple operator %(HTuple t1, HTuple t2) => t1.TupleMod(t2);

        public static HTuple operator %(HTuple t1, int t2) => t1 % (HTuple)t2;

        public static HTuple operator %(HTuple t1, long t2) => t1 % (HTuple)t2;

        public static HTuple operator %(HTuple t1, float t2) => t1 % (HTuple)(double)t2;

        public static HTuple operator %(HTuple t1, double t2) => t1 % (HTuple)t2;

        public static HTuple operator %(HTuple t1, string t2) => t1 % (HTuple)t2;

        public static HTuple operator %(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 % htuple;
        }

        public static HTuple operator &(HTuple t1, HTuple t2) => t1.TupleAnd(t2);

        public static HTuple operator &(HTuple t1, int t2) => t1 & (HTuple)t2;

        public static HTuple operator &(HTuple t1, long t2) => t1 & (HTuple)t2;

        public static HTuple operator &(HTuple t1, float t2) => t1 & (HTuple)(double)t2;

        public static HTuple operator &(HTuple t1, double t2) => t1 & (HTuple)t2;

        public static HTuple operator &(HTuple t1, string t2) => t1 & (HTuple)t2;

        public static HTuple operator &(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 & htuple;
        }

        public static HTuple operator |(HTuple t1, HTuple t2) => t1.TupleOr(t2);

        public static HTuple operator |(HTuple t1, int t2) => t1 | (HTuple)t2;

        public static HTuple operator |(HTuple t1, long t2) => t1 | (HTuple)t2;

        public static HTuple operator |(HTuple t1, float t2) => t1 | (HTuple)(double)t2;

        public static HTuple operator |(HTuple t1, double t2) => t1 | (HTuple)t2;

        public static HTuple operator |(HTuple t1, string t2) => t1 | (HTuple)t2;

        public static HTuple operator |(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 | htuple;
        }

        public static HTuple operator ^(HTuple t1, HTuple t2) => t1.TupleXor(t2);

        public static HTuple operator ^(HTuple t1, int t2) => t1 ^ (HTuple)t2;

        public static HTuple operator ^(HTuple t1, long t2) => t1 ^ (HTuple)t2;

        public static HTuple operator ^(HTuple t1, float t2) => t1 ^ (HTuple)(double)t2;

        public static HTuple operator ^(HTuple t1, double t2) => t1 ^ (HTuple)t2;

        public static HTuple operator ^(HTuple t1, string t2) => t1 ^ (HTuple)t2;

        public static HTuple operator ^(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 ^ htuple;
        }

        public static bool operator false(HTuple t) => !(bool)t;

        public static bool operator true(HTuple t) => (bool)t;

        public static HTuple operator <<(HTuple t1, int shift) => t1.TupleLsh((HTuple)shift);

        public static HTuple operator >>(HTuple t1, int shift) => t1.TupleRsh((HTuple)shift);

        public static bool operator <(HTuple t1, HTuple t2) => (int)t1.TupleLess(t2) != 0;

        public static bool operator <(HTuple t1, int t2) => t1 < (HTuple)t2;

        public static bool operator <(HTuple t1, long t2) => t1 < (HTuple)t2;

        public static bool operator <(HTuple t1, float t2) => t1 < (HTuple)(double)t2;

        public static bool operator <(HTuple t1, double t2) => t1 < (HTuple)t2;

        public static bool operator <(HTuple t1, string t2) => t1 < (HTuple)t2;

        public static bool operator <(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 < htuple;
        }

        public static bool operator >(HTuple t1, HTuple t2) => (int)t1.TupleGreater(t2) != 0;

        public static bool operator >(HTuple t1, int t2) => t1 > (HTuple)t2;

        public static bool operator >(HTuple t1, long t2) => t1 > (HTuple)t2;

        public static bool operator >(HTuple t1, float t2) => t1 > (HTuple)(double)t2;

        public static bool operator >(HTuple t1, double t2) => t1 > (HTuple)t2;

        public static bool operator >(HTuple t1, string t2) => t1 > (HTuple)t2;

        public static bool operator >(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 > htuple;
        }

        public static bool operator >=(HTuple t1, HTuple t2) => !(t1 < t2);

        public static bool operator >=(HTuple t1, int t2) => t1 >= (HTuple)t2;

        public static bool operator >=(HTuple t1, long t2) => t1 >= (HTuple)t2;

        public static bool operator >=(HTuple t1, float t2) => t1 >= (HTuple)(double)t2;

        public static bool operator >=(HTuple t1, double t2) => t1 >= (HTuple)t2;

        public static bool operator >=(HTuple t1, string t2) => t1 >= (HTuple)t2;

        public static bool operator >=(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 >= htuple;
        }

        public static bool operator <=(HTuple t1, HTuple t2) => !(t1 > t2);

        public static bool operator <=(HTuple t1, int t2) => t1 <= (HTuple)t2;

        public static bool operator <=(HTuple t1, long t2) => t1 <= (HTuple)t2;

        public static bool operator <=(HTuple t1, float t2) => t1 <= (HTuple)(double)t2;

        public static bool operator <=(HTuple t1, double t2) => t1 <= (HTuple)t2;

        public static bool operator <=(HTuple t1, string t2) => t1 <= (HTuple)t2;

        public static bool operator <=(HTuple t1, HTupleElements t2)
        {
            using (HTuple htuple = (HTuple)t2)
                return t1 <= htuple;
        }

        public static HTuple operator -(HTuple t) => t.TupleNeg();

        [EditorBrowsable(EditorBrowsableState.Never)]
        public bool Continue(HTuple final_value, HTuple increment)
        {
            return increment[0] < 0.0 ? this[0].D >= final_value[0].D : this[0].D <= final_value[0].D;
        }

        public void Append(HTuple tuple)
        {
            HTupleImplementation data = this.data;
            this.data = this.TupleConcat(tuple).data;
            data.Dispose();
        }

        private bool ProcessNative2To1(
          HTuple t2,
          HTuple.ResultSize type,
          out HTuple result,
          HTuple.NativeInt2To1 opInt,
          HTuple.NativeLong2To1 opLong,
          HTuple.NativeDouble2To1 opDouble)
        {
            int length = type == HTuple.ResultSize.EQUAL ? this.Length : this.Length + t2.Length;
            if (length == 0)
            {
                result = new HTuple();
                return true;
            }
            if (this.Type == t2.Type && (this.Length == t2.Length || type == HTuple.ResultSize.SUM))
            {
                if (this.Type == HTupleType.DOUBLE && opDouble != null)
                {
                    double[] darr1 = this.DArr;
                    double[] darr2 = t2.DArr;
                    double[] numArray = new double[length];
                    numArray[0] = (double)this.Length;
                    opDouble(darr1, darr2, numArray);
                    result = new HTuple((HTupleImplementation)new HTupleDouble(numArray, false));
                    return true;
                }
                if (this.Type == HTupleType.INTEGER && opInt != null)
                {
                    int[] iarr1 = this.IArr;
                    int[] iarr2 = t2.IArr;
                    int[] numArray = new int[length];
                    numArray[0] = this.Length;
                    opInt(iarr1, iarr2, numArray);
                    result = new HTuple((HTupleImplementation)new HTupleInt32(numArray, false));
                    return true;
                }
                if (this.Type == HTupleType.LONG && opLong != null)
                {
                    long[] larr1 = this.LArr;
                    long[] larr2 = t2.LArr;
                    long[] numArray = new long[length];
                    numArray[0] = (long)this.Length;
                    opLong(larr1, larr2, numArray);
                    result = new HTuple((HTupleImplementation)new HTupleInt64(numArray, false));
                    return true;
                }
            }
            result = (HTuple)null;
            return false;
        }

        private static void NativeIntAdd(int[] in1, int[] in2, int[] buffer)
        {
            for (int index = 0; index < buffer.Length; ++index)
                buffer[index] = in1[index] + in2[index];
        }

        private static void NativeLongAdd(long[] in1, long[] in2, long[] buffer)
        {
            for (int index = 0; index < buffer.Length; ++index)
                buffer[index] = in1[index] + in2[index];
        }

        private static void NativeDoubleAdd(double[] in1, double[] in2, double[] buffer)
        {
            for (int index = 0; index < buffer.Length; ++index)
                buffer[index] = in1[index] + in2[index];
        }

        private static void NativeIntSub(int[] in1, int[] in2, int[] buffer)
        {
            for (int index = 0; index < buffer.Length; ++index)
                buffer[index] = in1[index] - in2[index];
        }

        private static void NativeLongSub(long[] in1, long[] in2, long[] buffer)
        {
            for (int index = 0; index < buffer.Length; ++index)
                buffer[index] = in1[index] - in2[index];
        }

        private static void NativeDoubleSub(double[] in1, double[] in2, double[] buffer)
        {
            for (int index = 0; index < buffer.Length; ++index)
                buffer[index] = in1[index] - in2[index];
        }

        private static void NativeIntMult(int[] in1, int[] in2, int[] buffer)
        {
            for (int index = 0; index < buffer.Length; ++index)
                buffer[index] = in1[index] * in2[index];
        }

        private static void NativeLongMult(long[] in1, long[] in2, long[] buffer)
        {
            for (int index = 0; index < buffer.Length; ++index)
                buffer[index] = in1[index] * in2[index];
        }

        private static void NativeDoubleMult(double[] in1, double[] in2, double[] buffer)
        {
            for (int index = 0; index < buffer.Length; ++index)
                buffer[index] = in1[index] * in2[index];
        }

        public int TupleLength() => this.Length;

        public HTuple TupleAdd(HTuple s2)
        {
            HTuple result;
            if (!this.ProcessNative2To1(s2, HTuple.ResultSize.EQUAL, out result, HTuple.addInt, HTuple.addLong, HTuple.addDouble))
                result = this.TupleAddOp(s2);
            return result;
        }

        public HTuple TupleSub(HTuple d2)
        {
            HTuple result;
            if (!this.ProcessNative2To1(d2, HTuple.ResultSize.EQUAL, out result, HTuple.subInt, HTuple.subLong, HTuple.subDouble))
                result = this.TupleSubOp(d2);
            return result;
        }

        public HTuple TupleMult(HTuple p2)
        {
            HTuple result;
            if (!this.ProcessNative2To1(p2, HTuple.ResultSize.EQUAL, out result, HTuple.multInt, HTuple.multLong, HTuple.multDouble))
                result = this.TupleMultOp(p2);
            return result;
        }

        public HTuple TupleConcat(params HTuple[] tuples)
        {
            HTupleType type = this.Type;
            int length = this.Length;
            for (int index = 0; index < tuples.Length; ++index)
            {
                if (type == HTupleType.EMPTY)
                    type = tuples[index].Type;
                else if (type != tuples[index].Type && tuples[index].Type != HTupleType.EMPTY)
                    type = HTupleType.MIXED;
                length += tuples[index].Length;
            }
            if ((type == HTupleType.MIXED || type == HTupleType.HANDLE) && HalconAPI.IsLegacyHandleMode())
            {
                HTuple htuple1 = this;
                for (int index = 0; index < tuples.Length; ++index)
                {
                    HTuple htuple2 = htuple1;
                    htuple1 = htuple1.TupleConcat(tuples[index]);
                    if (index > 0)
                        htuple2.Dispose();
                }
                return htuple1;
            }
            HTupleImplementation instanceForType = HTupleImplementation.CreateInstanceForType(type, length);
            int offset = instanceForType.CopyFrom(this.data, 0);
            for (int index = 0; index < tuples.Length; ++index)
                offset += instanceForType.CopyFrom(tuples[index].data, offset);
            return new HTuple(instanceForType);
        }

        public HTuple TupleConcat(HTuple t2)
        {
            HTupleType type = this.Type;
            int size = this.Length + t2.Length;
            if (type == HTupleType.EMPTY)
                type = t2.Type;
            else if (type != t2.Type && t2.Type != HTupleType.EMPTY)
                type = HTupleType.MIXED;
            if ((type == HTupleType.MIXED || type == HTupleType.HANDLE) && HalconAPI.IsLegacyHandleMode())
                return this.TupleConcatOp(t2);
            HTupleImplementation instanceForType = HTupleImplementation.CreateInstanceForType(type, size);
            instanceForType.CopyFrom(t2.data, instanceForType.CopyFrom(this.data, 0));
            return new HTuple(instanceForType);
        }

        private delegate void NativeInt2To1(int[] in1, int[] in2, int[] buffer);

        private delegate void NativeLong2To1(long[] in1, long[] in2, long[] buffer);

        private delegate void NativeDouble2To1(double[] in1, double[] in2, double[] buffer);

        private enum ResultSize
        {
            EQUAL,
            SUM,
        }
    }
}
